package com.chif.goingplus.service;

import com.chif.goingplus.dao.EmpMapper;
import com.chif.goingplus.pojo.Emp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AdminServiceImpl implements AdminService{

    @Autowired
    private EmpMapper empMapper;

    @Override
    public int checkLogin(String username, String password) {
        //1.根据用户名获取用户信息
        Emp emp = empMapper.queryEmpByUserName(username);
        if (emp!=null){
            //1.1 获取到了,判断密码是否正确
            if (password.equals(emp.getEpassword())){
                //密码正确
                return 2;
            }else {
                //密码不正确
                return 1;
            }
        }else {
            //1.2 没获取到，用户名不存在
            return 0;
        }
    }
}
